var obj = {
  first: "1",
  second: {
    name: "abc",
    mykey: "2",
    third: {
      age: "30",
      mykey: "3"
    }
  },
  forth: "4",
  mykey: "5"
}
function dfs(obj) {
  for (let i in obj) {
    if (typeof (obj[i]) == 'object') {
      dfs(obj[i])
    } else {
      console.log(obj[i])
    }
  }
}